using System;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using Widgetsphere.Autos.EFDAL;
using System.Text.RegularExpressions;
using System.Linq.Expressions;
using System.Data.Entity;
using System.Data.Linq;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.Core.Objects.DataClasses;

namespace Widgetsphere.Autos.EFDAL.Entity
{
	/// <summary>
	/// The collection to hold 'Listing' entities
	/// </summary>
	[DataContract]
	[Serializable]
	[System.Data.Linq.Mapping.Table(Name = "Listing")]
	[System.CodeDom.Compiler.GeneratedCode("nHydrateModelGenerator", "5.3.0")]
	[EdmEntityTypeAttribute(NamespaceName = "Widgetsphere.Autos.EFDAL.Entity", Name = "Listing")]
	[nHydrate.EFCore.Attributes.FieldNameConstantsAttribute(typeof(Widgetsphere.Autos.EFDAL.Entity.Listing.FieldNameConstants))]
	[System.ComponentModel.DataAnnotations.MetadataType(typeof(Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.ListingMetadata))]
	[nHydrate.EFCore.Attributes.EntityMetadata("Listing", false, true, true, true, "", true, false, false, "dbo")]
	public partial class Listing : nHydrate.EFCore.DataAccess.BaseEntity, nHydrate.EFCore.DataAccess.IBusinessObject, Widgetsphere.Autos.EFDAL.IEntityWithContext, System.ComponentModel.IDataErrorInfo, Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing, System.ICloneable, System.IEquatable<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing>, nHydrate.EFCore.DataAccess.IAuditable
	{
		#region FieldNameConstants Enumeration

		/// <summary>
		/// Enumeration to define each property that maps to a database field for the 'Listing' table.
		/// </summary>
		public enum FieldNameConstants
		{
			/// <summary>
			/// Field mapping for the 'Active' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Active' property")]
			Active,
			/// <summary>
			/// Field mapping for the 'BodyTypeId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'BodyTypeId' property")]
			BodyTypeId,
			/// <summary>
			/// Field mapping for the 'ColorExtId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ColorExtId' property")]
			ColorExtId,
			/// <summary>
			/// Field mapping for the 'ColorIntId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ColorIntId' property")]
			ColorIntId,
			/// <summary>
			/// Field mapping for the 'ConditionId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ConditionId' property")]
			ConditionId,
			/// <summary>
			/// Field mapping for the 'Cylinders' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Cylinders' property")]
			Cylinders,
			/// <summary>
			/// Field mapping for the 'Description' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Description' property")]
			Description,
			/// <summary>
			/// Field mapping for the 'Disclaimer' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Disclaimer' property")]
			Disclaimer,
			/// <summary>
			/// Field mapping for the 'Doors' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Doors' property")]
			Doors,
			/// <summary>
			/// Field mapping for the 'Engine' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Engine' property")]
			Engine,
			/// <summary>
			/// Field mapping for the 'ExpirationDate' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ExpirationDate' property")]
			ExpirationDate,
			/// <summary>
			/// Field mapping for the 'FuelTypeId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'FuelTypeId' property")]
			FuelTypeId,
			/// <summary>
			/// Field mapping for the 'Invoice' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Invoice' property")]
			Invoice,
			/// <summary>
			/// Field mapping for the 'IsFeatured' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'IsFeatured' property")]
			IsFeatured,
			/// <summary>
			/// Field mapping for the 'ListDate' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ListDate' property")]
			ListDate,
			/// <summary>
			/// Field mapping for the 'ListingId' property
			/// </summary>
			[nHydrate.EFCore.Attributes.PrimaryKeyAttribute()]
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ListingId' property")]
			ListingId,
			/// <summary>
			/// Field mapping for the 'MakeModelId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'MakeModelId' property")]
			MakeModelId,
			/// <summary>
			/// Field mapping for the 'MetroId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'MetroId' property")]
			MetroId,
			/// <summary>
			/// Field mapping for the 'Mileage' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Mileage' property")]
			Mileage,
			/// <summary>
			/// Field mapping for the 'Price' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Price' property")]
			Price,
			/// <summary>
			/// Field mapping for the 'StockNumber' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'StockNumber' property")]
			StockNumber,
			/// <summary>
			/// Field mapping for the 'Title' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Title' property")]
			Title,
			/// <summary>
			/// Field mapping for the 'TransmissionId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'TransmissionId' property")]
			TransmissionId,
			/// <summary>
			/// Field mapping for the 'TrimLevel' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'TrimLevel' property")]
			TrimLevel,
			/// <summary>
			/// Field mapping for the 'UserId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'UserId' property")]
			UserId,
			/// <summary>
			/// Field mapping for the 'Vin' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Vin' property")]
			Vin,
			/// <summary>
			/// Field mapping for the 'Year' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Year' property")]
			Year,
			/// <summary>
			/// Field mapping for the 'CreatedBy' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'CreatedBy' property")]
			CreatedBy,
			/// <summary>
			/// Field mapping for the 'CreatedDate' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'CreatedDate' property")]
			CreatedDate,
			/// <summary>
			/// Field mapping for the 'ModifiedBy' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ModifiedBy' property")]
			ModifiedBy,
			/// <summary>
			/// Field mapping for the 'ModifiedDate' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ModifiedDate' property")]
			ModifiedDate,
		}
		#endregion

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the Widgetsphere.Autos.EFDAL.Entity.Listing class
		/// </summary>
		public Listing()
		{
			this._active = true;
			this._expirationDate = DateTime.Now;

		}

		#endregion

		#region Properties

		/// <summary>
		/// The property that maps back to the database 'Listing.Active' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Active], Not Nullable, Indexed, Default Value: 1</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("Active")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual bool Active
		{
			get { return _active; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<bool>(value, "Active");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_active = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Active"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.BodyTypeId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[BodyTypeId], Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("BodyTypeId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? BodyTypeId
		{
			get { return _bodyTypeId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "BodyTypeId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_bodyTypeId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("BodyTypeId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.ColorExtId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[ColorExtId], Not Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("ColorExtId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int ColorExtId
		{
			get { return _colorExtId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "ColorExtId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_colorExtId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("ColorExtId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.ColorIntId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[ColorIntId], Not Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("ColorIntId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int ColorIntId
		{
			get { return _colorIntId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "ColorIntId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_colorIntId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("ColorIntId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.ConditionId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[ConditionId], Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("ConditionId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? ConditionId
		{
			get { return _conditionId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "ConditionId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_conditionId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("ConditionId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Cylinders' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Cylinders], Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Cylinders")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? Cylinders
		{
			get { return _cylinders; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "Cylinders");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_cylinders = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Cylinders"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Description' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Description], Field Length: 1000, Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Description")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(1000)]
		public virtual string Description
		{
			get { return _description; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Description");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_description = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Description"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Disclaimer' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Disclaimer], Field Length: 5000, Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Disclaimer")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(5000)]
		public virtual string Disclaimer
		{
			get { return _disclaimer; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Disclaimer");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_disclaimer = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Disclaimer"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Doors' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Doors], Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Doors")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? Doors
		{
			get { return _doors; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "Doors");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_doors = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Doors"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Engine' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Engine], Field Length: 100, Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Engine")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(100)]
		public virtual string Engine
		{
			get { return _engine; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Engine");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_engine = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Engine"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.ExpirationDate' field.
		/// </summary>
		/// <remarks>Field: [Listing].[ExpirationDate], Not Nullable, Indexed, Default Value: getdate</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("ExpirationDate")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual DateTime ExpirationDate
		{
			get { return _expirationDate; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<DateTime>(value, "ExpirationDate");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_expirationDate = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("ExpirationDate"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.FuelTypeId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[FuelTypeId], Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("FuelTypeId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? FuelTypeId
		{
			get { return _fuelTypeId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "FuelTypeId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_fuelTypeId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("FuelTypeId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Invoice' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Invoice], Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Invoice")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? Invoice
		{
			get { return _invoice; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "Invoice");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_invoice = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Invoice"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.IsFeatured' field.
		/// </summary>
		/// <remarks>Field: [Listing].[IsFeatured], Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("IsFeatured")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual bool? IsFeatured
		{
			get { return _isFeatured; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<bool?>(value, "IsFeatured");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_isFeatured = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("IsFeatured"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.ListDate' field.
		/// </summary>
		/// <remarks>Field: [Listing].[ListDate], Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("ListDate")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual DateTime? ListDate
		{
			get { return _listDate; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<DateTime?>(value, "ListDate");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_listDate = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("ListDate"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.ListingId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[ListingId], Not Nullable, Primary Key, Unique, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
		[System.ComponentModel.DisplayName("ListingId")]
		[System.ComponentModel.DataAnnotations.Key()]
		[System.ComponentModel.ReadOnly(true)]
		[System.Diagnostics.DebuggerNonUserCode]
		[System.ComponentModel.DataAnnotations.Schema.DatabaseGenerated(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity)]
		public virtual int ListingId
		{
			get { return _listingId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "ListingId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_listingId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("ListingId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.MakeModelId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[MakeModelId], Not Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("MakeModelId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int MakeModelId
		{
			get { return _makeModelId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "MakeModelId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_makeModelId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("MakeModelId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.MetroId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[MetroId], Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("MetroId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? MetroId
		{
			get { return _metroId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "MetroId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_metroId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("MetroId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Mileage' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Mileage], Not Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("Mileage")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int Mileage
		{
			get { return _mileage; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "Mileage");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_mileage = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Mileage"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Price' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Price], Not Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("Price")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int Price
		{
			get { return _price; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "Price");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_price = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Price"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.StockNumber' field.
		/// </summary>
		/// <remarks>Field: [Listing].[StockNumber], Field Length: 50, Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("StockNumber")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(50)]
		public virtual string StockNumber
		{
			get { return _stockNumber; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "StockNumber");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_stockNumber = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("StockNumber"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Title' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Title], Field Length: 100, Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Title")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(100)]
		public virtual string Title
		{
			get { return _title; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Title");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_title = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Title"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.TransmissionId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[TransmissionId], Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("TransmissionId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? TransmissionId
		{
			get { return _transmissionId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "TransmissionId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_transmissionId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("TransmissionId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.TrimLevel' field.
		/// </summary>
		/// <remarks>Field: [Listing].[TrimLevel], Field Length: 10, Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("TrimLevel")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(10)]
		public virtual string TrimLevel
		{
			get { return _trimLevel; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "TrimLevel");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_trimLevel = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("TrimLevel"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.UserId' field.
		/// </summary>
		/// <remarks>Field: [Listing].[UserId], Not Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("UserId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int UserId
		{
			get { return _userId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "UserId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_userId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("UserId"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Vin' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Vin], Field Length: 50, Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Vin")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(50)]
		public virtual string Vin
		{
			get { return _vin; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Vin");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_vin = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Vin"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Listing.Year' field.
		/// </summary>
		/// <remarks>Field: [Listing].[Year], Not Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("Year")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int Year
		{
			get { return _year; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "Year");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_year = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Year"));
			}
		}

		/// <summary>
		/// The audit field for the 'Created By' parameter.
		/// </summary>
		[System.ComponentModel.Browsable(false)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual string CreatedBy
		{
			get { return _createdby; }
			protected internal set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "CreatedBy");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_createdby = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("CreatedBy"));
			}
		}

		/// <summary />
		protected string _createdby;

		/// <summary>
		/// The audit field for the 'Created Date' parameter.
		/// </summary>
		[System.ComponentModel.Browsable(false)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual DateTime? CreatedDate
		{
			get { return _createddate; }
			protected internal set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<DateTime?>(value, "CreatedDate");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_createddate = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("CreatedDate"));
			}
		}

		/// <summary />
		protected DateTime? _createddate;

		/// <summary>
		/// The audit field for the 'Modified By' parameter.
		/// </summary>
		[System.ComponentModel.Browsable(false)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual string ModifiedBy
		{
			get { return _modifiedby; }
			protected internal set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "ModifiedBy");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_modifiedby = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("ModifiedBy"));
			}
		}

		/// <summary />
		protected string _modifiedby;

		/// <summary>
		/// The audit field for the 'Modified Date' parameter.
		/// </summary>
		[System.ComponentModel.Browsable(false)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual DateTime? ModifiedDate
		{
			get { return _modifieddate; }
			protected internal set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<DateTime?>(value, "ModifiedDate");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_modifieddate = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("ModifiedDate"));
			}
		}

		/// <summary />
		protected DateTime? _modifieddate;

		/// <summary>
		/// The audit field for the 'Timestamp' parameter.
		/// </summary>
		[System.ComponentModel.Browsable(false)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual byte[] TimeStamp
		{
			get { return _timestamp; }
			protected internal set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<byte[]>(value, "TimeStamp");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_timestamp = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("TimeStamp"));
			}
		}

		/// <summary />
		protected byte[] _timestamp;

		#endregion

		#region Property Holders

		/// <summary />
		protected bool _active;
		/// <summary />
		protected int? _bodyTypeId;
		/// <summary />
		protected int _colorExtId;
		/// <summary />
		protected int _colorIntId;
		/// <summary />
		protected int? _conditionId;
		/// <summary />
		protected int? _cylinders;
		/// <summary />
		protected string _description;
		/// <summary />
		protected string _disclaimer;
		/// <summary />
		protected int? _doors;
		/// <summary />
		protected string _engine;
		/// <summary />
		protected DateTime _expirationDate;
		/// <summary />
		protected int? _fuelTypeId;
		/// <summary />
		protected int? _invoice;
		/// <summary />
		protected bool? _isFeatured;
		/// <summary />
		protected DateTime? _listDate;
		/// <summary />
		protected int _listingId;
		/// <summary />
		protected int _makeModelId;
		/// <summary />
		protected int? _metroId;
		/// <summary />
		protected int _mileage;
		/// <summary />
		protected int _price;
		/// <summary />
		protected string _stockNumber;
		/// <summary />
		protected string _title;
		/// <summary />
		protected int? _transmissionId;
		/// <summary />
		protected string _trimLevel;
		/// <summary />
		protected int _userId;
		/// <summary />
		protected string _vin;
		/// <summary />
		protected int _year;

		#endregion

		#region GetMaxLength

		/// <summary>
		/// Gets the maximum size of the field value.
		/// </summary>
		public static int GetMaxLength(FieldNameConstants field)
		{
			switch (field)
			{
				case FieldNameConstants.Active:
					return 0;
				case FieldNameConstants.BodyTypeId:
					return 0;
				case FieldNameConstants.ColorExtId:
					return 0;
				case FieldNameConstants.ColorIntId:
					return 0;
				case FieldNameConstants.ConditionId:
					return 0;
				case FieldNameConstants.Cylinders:
					return 0;
				case FieldNameConstants.Description:
					return 1000;
				case FieldNameConstants.Disclaimer:
					return 5000;
				case FieldNameConstants.Doors:
					return 0;
				case FieldNameConstants.Engine:
					return 100;
				case FieldNameConstants.ExpirationDate:
					return 0;
				case FieldNameConstants.FuelTypeId:
					return 0;
				case FieldNameConstants.Invoice:
					return 0;
				case FieldNameConstants.IsFeatured:
					return 0;
				case FieldNameConstants.ListDate:
					return 0;
				case FieldNameConstants.ListingId:
					return 0;
				case FieldNameConstants.MakeModelId:
					return 0;
				case FieldNameConstants.MetroId:
					return 0;
				case FieldNameConstants.Mileage:
					return 0;
				case FieldNameConstants.Price:
					return 0;
				case FieldNameConstants.StockNumber:
					return 50;
				case FieldNameConstants.Title:
					return 100;
				case FieldNameConstants.TransmissionId:
					return 0;
				case FieldNameConstants.TrimLevel:
					return 10;
				case FieldNameConstants.UserId:
					return 0;
				case FieldNameConstants.Vin:
					return 50;
				case FieldNameConstants.Year:
					return 0;
			}
			return 0;
		}

		int nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetMaxLength(Enum field)
		{
			return GetMaxLength((FieldNameConstants)field);
		}

		#endregion

		#region GetFieldNameConstants

		System.Type nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetFieldNameConstants()
		{
			return typeof(FieldNameConstants);
		}

		#endregion

		#region GetFieldType

		/// <summary>
		/// Gets the system type of a field on this object
		/// </summary>
		public static System.Type GetFieldType(FieldNameConstants field)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type 'Widgetsphere.Autos.EFDAL.Entity.Listing.FieldNameConstants'.");

			switch ((FieldNameConstants)field)
			{
				case FieldNameConstants.Active: return typeof(bool);
				case FieldNameConstants.BodyTypeId: return typeof(int?);
				case FieldNameConstants.ColorExtId: return typeof(int);
				case FieldNameConstants.ColorIntId: return typeof(int);
				case FieldNameConstants.ConditionId: return typeof(int?);
				case FieldNameConstants.Cylinders: return typeof(int?);
				case FieldNameConstants.Description: return typeof(string);
				case FieldNameConstants.Disclaimer: return typeof(string);
				case FieldNameConstants.Doors: return typeof(int?);
				case FieldNameConstants.Engine: return typeof(string);
				case FieldNameConstants.ExpirationDate: return typeof(DateTime);
				case FieldNameConstants.FuelTypeId: return typeof(int?);
				case FieldNameConstants.Invoice: return typeof(int?);
				case FieldNameConstants.IsFeatured: return typeof(bool?);
				case FieldNameConstants.ListDate: return typeof(DateTime?);
				case FieldNameConstants.ListingId: return typeof(int);
				case FieldNameConstants.MakeModelId: return typeof(int);
				case FieldNameConstants.MetroId: return typeof(int?);
				case FieldNameConstants.Mileage: return typeof(int);
				case FieldNameConstants.Price: return typeof(int);
				case FieldNameConstants.StockNumber: return typeof(string);
				case FieldNameConstants.Title: return typeof(string);
				case FieldNameConstants.TransmissionId: return typeof(int?);
				case FieldNameConstants.TrimLevel: return typeof(string);
				case FieldNameConstants.UserId: return typeof(int);
				case FieldNameConstants.Vin: return typeof(string);
				case FieldNameConstants.Year: return typeof(int);
			}
			return null;
		}

		System.Type nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetFieldType(Enum field)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type 'Widgetsphere.Autos.EFDAL.Entity.Listing.FieldNameConstants'.");

			return GetFieldType((Widgetsphere.Autos.EFDAL.Entity.Listing.FieldNameConstants)field);
		}

		#endregion

		#region Get/Set Value

		object nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetValue(System.Enum field)
		{
			return ((nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject)this).GetValue(field, null);
		}

		object nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetValue(System.Enum field, object defaultValue)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type '" + this.GetType().ToString() + ".FieldNameConstants'.");
			return this.GetValue((FieldNameConstants)field, defaultValue);
		}

		void nHydrate.EFCore.DataAccess.IBusinessObject.SetValue(System.Enum field, object newValue)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type '" + this.GetType().ToString() + ".FieldNameConstants'.");
			this.SetValue((FieldNameConstants)field, newValue);
		}

		#endregion

		#region PrimaryKey

		/// <summary>
		/// Hold the primary key for this object
		/// </summary>
		protected nHydrate.EFCore.DataAccess.IPrimaryKey _primaryKey = null;
		nHydrate.EFCore.DataAccess.IPrimaryKey nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.PrimaryKey
		{
			get { return null; }
		}

		#endregion

		#region Clone

		/// <summary>
		/// Creates a shallow copy of this object
		/// </summary>
		public virtual object Clone()
		{
			return Widgetsphere.Autos.EFDAL.Entity.Listing.Clone(this);
		}

		/// <summary>
		/// Creates a shallow copy of this object with defined, default values and new PK
		/// </summary>
		public virtual object CloneAsNew()
		{
			var item = Widgetsphere.Autos.EFDAL.Entity.Listing.Clone(this);
			item._listingId = 0;
			item._active = true;
			item._expirationDate = DateTime.Now;
			return item;
		}

		/// <summary>
		/// Creates a shallow copy of this object
		/// </summary>
		public static Listing Clone(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing item)
		{
			var newItem = new Listing();
			newItem.Active = item.Active;
			newItem.BodyTypeId = item.BodyTypeId;
			newItem.ColorExtId = item.ColorExtId;
			newItem.ColorIntId = item.ColorIntId;
			newItem.ConditionId = item.ConditionId;
			newItem.Cylinders = item.Cylinders;
			newItem.Description = item.Description;
			newItem.Disclaimer = item.Disclaimer;
			newItem.Doors = item.Doors;
			newItem.Engine = item.Engine;
			newItem.ExpirationDate = item.ExpirationDate;
			newItem.FuelTypeId = item.FuelTypeId;
			newItem.Invoice = item.Invoice;
			newItem.IsFeatured = item.IsFeatured;
			newItem.ListDate = item.ListDate;
			newItem.ListingId = item.ListingId;
			newItem.MakeModelId = item.MakeModelId;
			newItem.MetroId = item.MetroId;
			newItem.Mileage = item.Mileage;
			newItem.Price = item.Price;
			newItem.StockNumber = item.StockNumber;
			newItem.Title = item.Title;
			newItem.TransmissionId = item.TransmissionId;
			newItem.TrimLevel = item.TrimLevel;
			newItem.UserId = item.UserId;
			newItem.Vin = item.Vin;
			newItem.Year = item.Year;
			newItem.CreatedDate = item.CreatedDate;
			newItem.CreatedBy = item.CreatedBy;
			newItem.ModifiedDate = item.ModifiedDate;
			newItem.ModifiedBy = item.ModifiedBy;
			return newItem;
		}

		#endregion

		#region IsEquivalent

		/// <summary>
		/// Determines if all of the fields for the specified object exactly matches the current object.
		/// </summary>
		/// <param name="item">The object to compare</param>
		public override bool IsEquivalent(nHydrate.EFCore.DataAccess.INHEntityObject item)
		{
			return ((System.IEquatable<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing>)this).Equals(item as Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing);
		}

		#endregion

		#region GetValue

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public object GetValue(FieldNameConstants field)
		{
			return GetValue(field, null);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public object GetValue(FieldNameConstants field, object defaultValue)
		{
			if (field == FieldNameConstants.Active)
				return this.Active;
			if (field == FieldNameConstants.BodyTypeId)
				return ((this.BodyTypeId == null) ? defaultValue : this.BodyTypeId);
			if (field == FieldNameConstants.ColorExtId)
				return this.ColorExtId;
			if (field == FieldNameConstants.ColorIntId)
				return this.ColorIntId;
			if (field == FieldNameConstants.ConditionId)
				return ((this.ConditionId == null) ? defaultValue : this.ConditionId);
			if (field == FieldNameConstants.Cylinders)
				return ((this.Cylinders == null) ? defaultValue : this.Cylinders);
			if (field == FieldNameConstants.Description)
				return ((this.Description == null) ? defaultValue : this.Description);
			if (field == FieldNameConstants.Disclaimer)
				return ((this.Disclaimer == null) ? defaultValue : this.Disclaimer);
			if (field == FieldNameConstants.Doors)
				return ((this.Doors == null) ? defaultValue : this.Doors);
			if (field == FieldNameConstants.Engine)
				return ((this.Engine == null) ? defaultValue : this.Engine);
			if (field == FieldNameConstants.ExpirationDate)
				return this.ExpirationDate;
			if (field == FieldNameConstants.FuelTypeId)
				return ((this.FuelTypeId == null) ? defaultValue : this.FuelTypeId);
			if (field == FieldNameConstants.Invoice)
				return ((this.Invoice == null) ? defaultValue : this.Invoice);
			if (field == FieldNameConstants.IsFeatured)
				return ((this.IsFeatured == null) ? defaultValue : this.IsFeatured);
			if (field == FieldNameConstants.ListDate)
				return ((this.ListDate == null) ? defaultValue : this.ListDate);
			if (field == FieldNameConstants.ListingId)
				return this.ListingId;
			if (field == FieldNameConstants.MakeModelId)
				return this.MakeModelId;
			if (field == FieldNameConstants.MetroId)
				return ((this.MetroId == null) ? defaultValue : this.MetroId);
			if (field == FieldNameConstants.Mileage)
				return this.Mileage;
			if (field == FieldNameConstants.Price)
				return this.Price;
			if (field == FieldNameConstants.StockNumber)
				return ((this.StockNumber == null) ? defaultValue : this.StockNumber);
			if (field == FieldNameConstants.Title)
				return ((this.Title == null) ? defaultValue : this.Title);
			if (field == FieldNameConstants.TransmissionId)
				return ((this.TransmissionId == null) ? defaultValue : this.TransmissionId);
			if (field == FieldNameConstants.TrimLevel)
				return ((this.TrimLevel == null) ? defaultValue : this.TrimLevel);
			if (field == FieldNameConstants.UserId)
				return this.UserId;
			if (field == FieldNameConstants.Vin)
				return ((this.Vin == null) ? defaultValue : this.Vin);
			if (field == FieldNameConstants.Year)
				return this.Year;
			if (field == FieldNameConstants.CreatedBy)
				return ((this.CreatedBy == null) ? defaultValue : this.CreatedBy);
			if (field == FieldNameConstants.CreatedDate)
				return ((this.CreatedDate == null) ? defaultValue : this.CreatedDate);
			if (field == FieldNameConstants.ModifiedBy)
				return ((this.ModifiedBy == null) ? defaultValue : this.ModifiedBy);
			if (field == FieldNameConstants.ModifiedDate)
				return ((this.ModifiedDate == null) ? defaultValue : this.ModifiedDate);
			throw new Exception("Field '" + field.ToString() + "' not found!");
		}

		#endregion

		#region SetValue

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="field">The field to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public virtual void SetValue(FieldNameConstants field, object newValue)
		{
			SetValue(field, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="field">The field to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public virtual void SetValue(FieldNameConstants field, object newValue, bool fixLength)
		{
			if (field == FieldNameConstants.Active)
			{
				this.Active = GlobalValues.SetValueHelperBoolNotNullableInternal(newValue, "Field 'Active' does not allow null values!");
			}
			else if (field == FieldNameConstants.BodyTypeId)
			{
				this.BodyTypeId = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.ColorExtId)
			{
				this.ColorExtId = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'ColorExtId' does not allow null values!");
			}
			else if (field == FieldNameConstants.ColorIntId)
			{
				this.ColorIntId = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'ColorIntId' does not allow null values!");
			}
			else if (field == FieldNameConstants.ConditionId)
			{
				this.ConditionId = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.Cylinders)
			{
				this.Cylinders = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.Description)
			{
				this.Description = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Disclaimer)
			{
				this.Disclaimer = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Doors)
			{
				this.Doors = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.Engine)
			{
				this.Engine = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.ExpirationDate)
			{
				this.ExpirationDate = GlobalValues.SetValueHelperDateTimeNotNullableInternal(newValue, "Field 'ExpirationDate' does not allow null values!");
			}
			else if (field == FieldNameConstants.FuelTypeId)
			{
				this.FuelTypeId = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.Invoice)
			{
				this.Invoice = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.IsFeatured)
			{
				this.IsFeatured = GlobalValues.SetValueHelperBoolNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.ListDate)
			{
				this.ListDate = GlobalValues.SetValueHelperDateTimeNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.ListingId)
			{
				throw new Exception("Field '" + field.ToString() + "' is a primary key and cannot be set!");
			}
			else if (field == FieldNameConstants.MakeModelId)
			{
				this.MakeModelId = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'MakeModelId' does not allow null values!");
			}
			else if (field == FieldNameConstants.MetroId)
			{
				this.MetroId = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.Mileage)
			{
				this.Mileage = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'Mileage' does not allow null values!");
			}
			else if (field == FieldNameConstants.Price)
			{
				this.Price = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'Price' does not allow null values!");
			}
			else if (field == FieldNameConstants.StockNumber)
			{
				this.StockNumber = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Title)
			{
				this.Title = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.TransmissionId)
			{
				this.TransmissionId = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.TrimLevel)
			{
				this.TrimLevel = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.UserId)
			{
				this.UserId = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'UserId' does not allow null values!");
			}
			else if (field == FieldNameConstants.Vin)
			{
				this.Vin = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Year)
			{
				this.Year = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'Year' does not allow null values!");
			}
			else
				throw new Exception("Field '" + field.ToString() + "' not found!");
		}

		#endregion

		#region Navigation Properties

		/// <summary>
		/// The navigation definition for walking Listing->Feature
		/// </summary>
		[DataMember]
		public virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.Feature> FeatureList
		{
			get
			{
				if (_FeatureList == null) _FeatureList = new List<Widgetsphere.Autos.EFDAL.Entity.Feature>();
				return _FeatureList;
			}
			set { _FeatureList = value; }
		}
		/// <summary />
		protected virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.Feature> _FeatureList { get; set; }

		ICollection<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFeature> Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.FeatureList
		{
			get { return this.FeatureList.Cast<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFeature>().ToList(); }
		}

		/// <summary>
		/// The navigation definition for walking Listing->BulletPoint
		/// </summary>
		[DataMember]
		public virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.BulletPoint> BulletPointList
		{
			get
			{
				if (_BulletPointList == null) _BulletPointList = new List<Widgetsphere.Autos.EFDAL.Entity.BulletPoint>();
				return _BulletPointList;
			}
			set { _BulletPointList = value; }
		}
		/// <summary />
		protected virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.BulletPoint> _BulletPointList { get; set; }

		ICollection<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBulletPoint> Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.BulletPointList
		{
			get { return this.BulletPointList.Cast<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBulletPoint>().ToList(); }
		}

		/// <summary>
		/// The navigation definition for walking Listing->ListingView
		/// </summary>
		[DataMember]
		public virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.ListingView> ListingViewList
		{
			get
			{
				if (_ListingViewList == null) _ListingViewList = new List<Widgetsphere.Autos.EFDAL.Entity.ListingView>();
				return _ListingViewList;
			}
			set { _ListingViewList = value; }
		}
		/// <summary />
		protected virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.ListingView> _ListingViewList { get; set; }

		ICollection<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingView> Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.ListingViewList
		{
			get { return this.ListingViewList.Cast<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingView>().ToList(); }
		}

		/// <summary>
		/// The navigation definition for walking Listing->ListingImage
		/// </summary>
		[DataMember]
		public virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.ListingImage> ListingImageList
		{
			get
			{
				if (_ListingImageList == null) _ListingImageList = new List<Widgetsphere.Autos.EFDAL.Entity.ListingImage>();
				return _ListingImageList;
			}
			set { _ListingImageList = value; }
		}
		/// <summary />
		protected virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.ListingImage> _ListingImageList { get; set; }

		ICollection<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingImage> Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.ListingImageList
		{
			get { return this.ListingImageList.Cast<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingImage>().ToList(); }
		}

		/// <summary>
		/// The navigation definition for walking Listing->ListingPremium
		/// </summary>
		[DataMember]
		public virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.ListingPremium> ListingPremiumList
		{
			get
			{
				if (_ListingPremiumList == null) _ListingPremiumList = new List<Widgetsphere.Autos.EFDAL.Entity.ListingPremium>();
				return _ListingPremiumList;
			}
			set { _ListingPremiumList = value; }
		}
		/// <summary />
		protected virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.ListingPremium> _ListingPremiumList { get; set; }

		ICollection<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingPremium> Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.ListingPremiumList
		{
			get { return this.ListingPremiumList.Cast<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingPremium>().ToList(); }
		}

		/// <summary>
		/// The navigation definition for walking Listing->ListingSaved
		/// </summary>
		[DataMember]
		public virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.ListingSaved> ListingSavedList
		{
			get
			{
				if (_ListingSavedList == null) _ListingSavedList = new List<Widgetsphere.Autos.EFDAL.Entity.ListingSaved>();
				return _ListingSavedList;
			}
			set { _ListingSavedList = value; }
		}
		/// <summary />
		protected virtual ICollection<Widgetsphere.Autos.EFDAL.Entity.ListingSaved> _ListingSavedList { get; set; }

		ICollection<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingSaved> Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.ListingSavedList
		{
			get { return this.ListingSavedList.Cast<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListingSaved>().ToList(); }
		}

		/// <summary>
		/// The navigation definition for walking BodyType->Listing
		/// </summary>
		[DataMember]
		public virtual BodyType BodyType { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.IBodyType Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.BodyType
		{
			get { return this.BodyType; }
			set { this.BodyType = (Widgetsphere.Autos.EFDAL.Entity.BodyType)value; }
		}

		/// <summary>
		/// The navigation definition for walking Color->Listing (role: 'Exterior')
		/// </summary>
		[DataMember]
		public virtual Color ExteriorColor { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.IColor Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.ExteriorColor
		{
			get { return this.ExteriorColor; }
			set { this.ExteriorColor = (Widgetsphere.Autos.EFDAL.Entity.Color)value; }
		}

		/// <summary>
		/// The navigation definition for walking Color->Listing (role: 'Interior')
		/// </summary>
		[DataMember]
		public virtual Color InteriorColor { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.IColor Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.InteriorColor
		{
			get { return this.InteriorColor; }
			set { this.InteriorColor = (Widgetsphere.Autos.EFDAL.Entity.Color)value; }
		}

		/// <summary>
		/// The navigation definition for walking Condition->Listing
		/// </summary>
		[DataMember]
		public virtual Condition Condition { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.ICondition Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.Condition
		{
			get { return this.Condition; }
			set { this.Condition = (Widgetsphere.Autos.EFDAL.Entity.Condition)value; }
		}

		/// <summary>
		/// The navigation definition for walking FuelType->Listing
		/// </summary>
		[DataMember]
		public virtual FuelType FuelType { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.IFuelType Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.FuelType
		{
			get { return this.FuelType; }
			set { this.FuelType = (Widgetsphere.Autos.EFDAL.Entity.FuelType)value; }
		}

		/// <summary>
		/// The navigation definition for walking MakeModel->Listing
		/// </summary>
		[DataMember]
		public virtual MakeModel MakeModel { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMakeModel Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.MakeModel
		{
			get { return this.MakeModel; }
			set { this.MakeModel = (Widgetsphere.Autos.EFDAL.Entity.MakeModel)value; }
		}

		/// <summary>
		/// The navigation definition for walking Metro->Listing
		/// </summary>
		[DataMember]
		public virtual Metro Metro { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMetro Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.Metro
		{
			get { return this.Metro; }
			set { this.Metro = (Widgetsphere.Autos.EFDAL.Entity.Metro)value; }
		}

		/// <summary>
		/// The navigation definition for walking Transmission->Listing
		/// </summary>
		[DataMember]
		public virtual Transmission Transmission { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.ITransmission Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.Transmission
		{
			get { return this.Transmission; }
			set { this.Transmission = (Widgetsphere.Autos.EFDAL.Entity.Transmission)value; }
		}

		/// <summary>
		/// The navigation definition for walking UserAccount->Listing
		/// </summary>
		[DataMember]
		public virtual UserAccount UserAccount { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.IUserAccount Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing.UserAccount
		{
			get { return this.UserAccount; }
			set { this.UserAccount = (Widgetsphere.Autos.EFDAL.Entity.UserAccount)value; }
		}

		#endregion

		#region Static SQL Methods

		internal static string GetFieldAliasFromFieldNameSqlMapping(string alias)
		{
			alias = alias.Replace("[", string.Empty).Replace("]", string.Empty);
			switch (alias.ToLower())
			{
				case "active": return "active";
				case "bodytypeid": return "bodytypeid";
				case "colorextid": return "colorextid";
				case "colorintid": return "colorintid";
				case "conditionid": return "conditionid";
				case "cylinders": return "cylinders";
				case "description": return "description";
				case "disclaimer": return "disclaimer";
				case "doors": return "doors";
				case "engine": return "engine";
				case "expirationdate": return "expirationdate";
				case "fueltypeid": return "fueltypeid";
				case "invoice": return "invoice";
				case "isfeatured": return "isfeatured";
				case "listdate": return "listdate";
				case "listingid": return "listingid";
				case "makemodelid": return "makemodelid";
				case "metroid": return "metroid";
				case "mileage": return "mileage";
				case "price": return "price";
				case "stocknumber": return "stocknumber";
				case "title": return "title";
				case "transmissionid": return "transmissionid";
				case "trimlevel": return "trimlevel";
				case "userid": return "userid";
				case "vin": return "vin";
				case "year": return "year";
				case "createddate": return "createddate";
				case "createdby": return "createdby";
				case "modifieddate": return "modifieddate";
				case "modifiedby": return "modifiedby";
				case "timestamp": return "timestamp";
				default: throw new Exception("The select clause is not valid.");
			}
		}

		internal static string GetTableFromFieldAliasSqlMapping(string alias)
		{
			switch (alias.ToLower())
			{
				case "active": return "Listing";
				case "bodytypeid": return "Listing";
				case "colorextid": return "Listing";
				case "colorintid": return "Listing";
				case "conditionid": return "Listing";
				case "cylinders": return "Listing";
				case "description": return "Listing";
				case "disclaimer": return "Listing";
				case "doors": return "Listing";
				case "engine": return "Listing";
				case "expirationdate": return "Listing";
				case "fueltypeid": return "Listing";
				case "invoice": return "Listing";
				case "isfeatured": return "Listing";
				case "listdate": return "Listing";
				case "listingid": return "Listing";
				case "makemodelid": return "Listing";
				case "metroid": return "Listing";
				case "mileage": return "Listing";
				case "price": return "Listing";
				case "stocknumber": return "Listing";
				case "title": return "Listing";
				case "transmissionid": return "Listing";
				case "trimlevel": return "Listing";
				case "userid": return "Listing";
				case "vin": return "Listing";
				case "year": return "Listing";
				case "createdby": return "Listing";
				case "createddate": return "Listing";
				case "modifiedby": return "Listing";
				case "modifieddate": return "Listing";
				case "timestamp": return "Listing";
				default: throw new Exception("The select clause is not valid.");
			}
		}

		internal static string GetTableFromFieldNameSqlMapping(string field)
		{
			switch (field.ToLower())
			{
				case "active": return "Listing";
				case "bodytypeid": return "Listing";
				case "colorextid": return "Listing";
				case "colorintid": return "Listing";
				case "conditionid": return "Listing";
				case "cylinders": return "Listing";
				case "description": return "Listing";
				case "disclaimer": return "Listing";
				case "doors": return "Listing";
				case "engine": return "Listing";
				case "expirationdate": return "Listing";
				case "fueltypeid": return "Listing";
				case "invoice": return "Listing";
				case "isfeatured": return "Listing";
				case "listdate": return "Listing";
				case "listingid": return "Listing";
				case "makemodelid": return "Listing";
				case "metroid": return "Listing";
				case "mileage": return "Listing";
				case "price": return "Listing";
				case "stocknumber": return "Listing";
				case "title": return "Listing";
				case "transmissionid": return "Listing";
				case "trimlevel": return "Listing";
				case "userid": return "Listing";
				case "vin": return "Listing";
				case "year": return "Listing";
				case "createdby": return "Listing";
				case "createddate": return "Listing";
				case "modifiedby": return "Listing";
				case "modifieddate": return "Listing";
				case "timestamp": return "Listing";
				default: throw new Exception("The select clause is not valid.");
			}
		}

		internal static string GetRemappedLinqSql(string sql, string parentAlias, LinqSQLFromClauseCollection childTables)
		{
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[active\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[active]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[bodytypeid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[bodytypeid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[colorextid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[colorextid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[colorintid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[colorintid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[conditionid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[conditionid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[cylinders\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[cylinders]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[description\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[description]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[disclaimer\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[disclaimer]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[doors\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[doors]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[engine\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[engine]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[expirationdate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[expirationdate]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[fueltypeid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[fueltypeid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[invoice\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[invoice]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[isfeatured\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[isfeatured]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[listdate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[listdate]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[listingid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[listingid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[makemodelid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[makemodelid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[metroid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[metroid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[mileage\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[mileage]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[price\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[price]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[stocknumber\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[stocknumber]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[title\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[title]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[transmissionid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[transmissionid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[trimlevel\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[trimlevel]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[userid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[userid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[vin\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[vin]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[year\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[year]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[createdby\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[createdby]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[createddate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[createddate]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[modifiedby\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[modifiedby]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[modifieddate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[modifieddate]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[timestamp\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Listing") + "].[timestamp]", RegexOptions.IgnoreCase);
			return sql;
		}

		#endregion

		#region DeleteData

		/// <summary>
		/// Delete all records that match a where condition
		/// </summary>
		/// <param name="where">The expression that determines the records deleted</param>
		/// <returns>The number of rows deleted</returns>
		public static int DeleteData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where)
		{
			return DeleteData(where, new nHydrate.EFCore.DataAccess.QueryOptimizer(), new ContextStartup(null), Widgetsphere.Autos.EFDAL.AutosEntities.GetConnectionString());
		}

		/// <summary>
		/// Delete all records that match a where condition
		/// </summary>
		/// <param name="where">The expression that determines the records deleted</param>
		/// <param name="optimizer">The optimization object to use for running queries</param>
		/// <returns>The number of rows deleted</returns>
		public static int DeleteData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, nHydrate.EFCore.DataAccess.QueryOptimizer optimizer)
		{
			return DeleteData(where, optimizer, new ContextStartup(null), Widgetsphere.Autos.EFDAL.AutosEntities.GetConnectionString());
		}

		/// <summary>
		/// Delete all records that match a where condition
		/// </summary>
		/// <param name="where">The expression that determines the records deleted</param>
		/// <param name="connectionString">The database connection string to use for this access</param>
		/// <returns>The number of rows deleted</returns>
		public static int DeleteData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, string connectionString)
		{
			return DeleteData(where, new nHydrate.EFCore.DataAccess.QueryOptimizer(), new ContextStartup(null), connectionString);
		}

		/// <summary>
		/// Delete all records that match a where condition
		/// </summary>
		/// <param name="where">The expression that determines the records deleted</param>
		/// <param name="optimizer">The optimization object to use for running queries</param>
		/// <param name="startup">The startup options</param>
		/// <param name="connectionString">The database connection string to use for this access</param>
		/// <returns>The number of rows deleted</returns>
		public static int DeleteData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, nHydrate.EFCore.DataAccess.QueryOptimizer optimizer, ContextStartup startup, string connectionString)
		{
			if (optimizer == null)
				optimizer = new nHydrate.EFCore.DataAccess.QueryOptimizer();
				if (startup == null) startup = new ContextStartup(null);

			using (var connection = Widgetsphere.Autos.EFDAL.DBHelper.GetConnection(Widgetsphere.Autos.EFDAL.Util.StripEFCS2Normal(connectionString)))
			{
				using (var dc = new DataContext(connection))
				{
					var template = dc.GetTable<Widgetsphere.Autos.EFDAL.ListingQuery>();
					using (var cmd = nHydrate.EFCore.DataAccess.BusinessEntityQuery.GetCommand<Widgetsphere.Autos.EFDAL.ListingQuery>(dc, template, where))
					{
						if (startup.CommandTimeout != null && startup.CommandTimeout > 0) cmd.CommandTimeout = startup.CommandTimeout.Value;
						else cmd.CommandTimeout = 30;

						var parser = LinqSQLParser.Create(cmd.CommandText, LinqSQLParser.ObjectTypeConstants.Table);
						var sql = "CREATE TABLE #t ([ListingId] [Int])";
						sql += "INSERT INTO #t ([ListingId])";
						sql += "SELECT [t0].[ListingId] #t\r\n";
						sql += parser.GetFromClause(optimizer) + "\r\n";
						sql += parser.GetWhereClause();
						sql += "\r\n";

						var noLock = string.Empty;
						noLock = (optimizer.NoLocking ? "WITH (NOLOCK) " : string.Empty);
						sql += "DELETE [Listing] FROM [dbo].[Listing] " + noLock + "INNER JOIN #t ON [dbo].[Listing].[ListingId] = #t.[ListingId]\r\n";
						sql += ";select @@rowcount";
						if (startup.IsAdmin) sql = LinqSQLParser.RemapTenantToAdminSql(sql);
						sql = "set ansi_nulls off;" + sql;
						cmd.CommandText = sql;
						dc.Connection.Open();
						var startTime = DateTime.Now;
						object p = cmd.ExecuteScalar();
						var endTime = DateTime.Now;
						optimizer.TotalMilliseconds = (long)endTime.Subtract(startTime).TotalMilliseconds;
						dc.Connection.Close();
						return (int)p;
					}
				}
			}
		}

		#endregion

		#region UpdateData

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, int>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, int newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, int>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, int?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, int? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, int?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, int>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, int newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, int>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, int?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, int? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, int?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, int>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, int newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, int>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, int?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, int? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, int?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Single>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Single newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Single>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Single?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Single? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Single?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Single>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Single newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Single>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Single?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Single? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Single?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Single>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Single newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Single>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Single?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Single? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Single?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, decimal>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, decimal newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, decimal>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, decimal?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, decimal? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, decimal?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, decimal>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, decimal newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, decimal>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, decimal?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, decimal? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, decimal?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, decimal>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, decimal newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, decimal>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, decimal?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, decimal? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, decimal?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, double>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, double newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, double>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, double?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, double? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, double?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, double>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, double newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, double>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, double?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, double? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, double?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, double>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, double newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, double>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, double?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, double? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, double?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, short>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, short newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, short>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, short?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, short? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, short?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, short>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, short newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, short>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, short?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, short? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, short?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, short>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, short newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, short>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, short?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, short? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, short?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, string>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, string newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, string>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, string>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, string newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, string>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, string>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, string newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, string>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, DateTime>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, DateTime newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, DateTime>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, DateTime?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, DateTime? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, DateTime?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, DateTime>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, DateTime newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, DateTime>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, DateTime?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, DateTime? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, DateTime?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, DateTime>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, DateTime newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, DateTime>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, DateTime?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, DateTime? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, DateTime?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, bool newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, bool>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, bool? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, bool?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, bool newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, bool>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, bool? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, bool?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, bool newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, bool>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, bool? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, bool?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Guid>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Guid newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Guid>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Guid?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Guid? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Guid?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Guid>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Guid newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Guid>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Guid?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Guid? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Guid?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Guid>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Guid newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Guid>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, Guid?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.ListingQuery, bool>> where, Guid? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Listing, Widgetsphere.Autos.EFDAL.ListingQuery, Guid?>.UpdateData(select, where, newValue, "Listing", GetDatabaseFieldName, true, null, connection, transaction);
		}

		#endregion

		#region GetDatabaseFieldName

		/// <summary>
		/// Returns the actual database name of the specified field.
		/// </summary>
		internal static string GetDatabaseFieldName(Listing.FieldNameConstants field)
		{
			return GetDatabaseFieldName(field.ToString());
		}

		/// <summary>
		/// Returns the actual database name of the specified field.
		/// </summary>
		internal static string GetDatabaseFieldName(string field)
		{
			switch (field)
			{
				case "Active": return "Active";
				case "BodyTypeId": return "BodyTypeId";
				case "ColorExtId": return "ColorExtId";
				case "ColorIntId": return "ColorIntId";
				case "ConditionId": return "ConditionId";
				case "Cylinders": return "Cylinders";
				case "Description": return "Description";
				case "Disclaimer": return "Disclaimer";
				case "Doors": return "Doors";
				case "Engine": return "Engine";
				case "ExpirationDate": return "ExpirationDate";
				case "FuelTypeId": return "FuelTypeId";
				case "Invoice": return "Invoice";
				case "IsFeatured": return "IsFeatured";
				case "ListDate": return "ListDate";
				case "ListingId": return "ListingId";
				case "MakeModelId": return "MakeModelId";
				case "MetroId": return "MetroId";
				case "Mileage": return "Mileage";
				case "Price": return "Price";
				case "StockNumber": return "StockNumber";
				case "Title": return "Title";
				case "TransmissionId": return "TransmissionId";
				case "TrimLevel": return "TrimLevel";
				case "UserId": return "UserId";
				case "Vin": return "Vin";
				case "Year": return "Year";
				case "CreatedBy": return "CreatedBy";
				case "CreatedDate": return "CreatedDate";
				case "ModifiedBy": return "ModifiedBy";
				case "ModifiedDate": return "ModifiedDate";
				case "TimeStamp": return "TimeStamp";
			}
			return string.Empty;
		}

		#endregion

		#region Context

		AutosEntities IEntityWithContext.Context
		{
			get { return _internalContext; }
			set { _internalContext = value; }
		}
		private AutosEntities _internalContext = null;

		#endregion

		#region Auditing
		string nHydrate.EFCore.DataAccess.IAuditable.CreatedBy
		{
			get { return this.CreatedBy; }
		}

		System.DateTime? nHydrate.EFCore.DataAccess.IAuditable.CreatedDate
		{
			get { return this.CreatedDate; }
		}

		bool nHydrate.EFCore.DataAccess.IAuditable.IsCreateAuditImplemented
		{
			get { return true; }
		}

		bool nHydrate.EFCore.DataAccess.IAuditable.IsModifyAuditImplemented
		{
			get { return true; }
		}

		bool nHydrate.EFCore.DataAccess.IAuditable.IsTimestampAuditImplemented
		{
			get { return true; }
		}

		string nHydrate.EFCore.DataAccess.IAuditable.ModifiedBy
		{
			get { return this.ModifiedBy; }
		}

		System.DateTime? nHydrate.EFCore.DataAccess.IAuditable.ModifiedDate
		{
			get { return this.ModifiedDate; }
		}

		byte[] nHydrate.EFCore.DataAccess.IAuditable.TimeStamp
		{
			get { return this.TimeStamp; }
		}

		internal virtual void ResetModifiedBy(string modifier)
		{
			if (this.ModifiedBy != modifier)
				this.ModifiedBy = modifier;
		}

		internal virtual void ResetCreatedBy(string modifier)
		{
			if (this.CreatedBy != modifier)
				this.CreatedBy = modifier;
			this.ResetModifiedBy(modifier);
		}
		#endregion

		#region Equals
		/// <summary>
		/// Compares two objects of 'Listing' type and determines if all properties match
		/// </summary>
		/// <returns>True if all properties match, false otherwise</returns>
		bool System.IEquatable<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing>.Equals(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IListing other)
		{
			return this.Equals(other);
		}

		/// <summary>
		/// Compares two objects of 'Listing' type and determines if all properties match
		/// </summary>
		/// <returns>True if all properties match, false otherwise</returns>
		public override bool Equals(object obj)
		{
			var other = obj as Widgetsphere.Autos.EFDAL.Entity.Listing;
			if (other == null) return false;
			return (
				other.Active == this.Active &&
				other.BodyTypeId == this.BodyTypeId &&
				other.ColorExtId == this.ColorExtId &&
				other.ColorIntId == this.ColorIntId &&
				other.ConditionId == this.ConditionId &&
				other.Cylinders == this.Cylinders &&
				other.Description == this.Description &&
				other.Disclaimer == this.Disclaimer &&
				other.Doors == this.Doors &&
				other.Engine == this.Engine &&
				other.ExpirationDate == this.ExpirationDate &&
				other.FuelTypeId == this.FuelTypeId &&
				other.Invoice == this.Invoice &&
				other.IsFeatured == this.IsFeatured &&
				other.ListDate == this.ListDate &&
				other.ListingId == this.ListingId &&
				other.MakeModelId == this.MakeModelId &&
				other.MetroId == this.MetroId &&
				other.Mileage == this.Mileage &&
				other.Price == this.Price &&
				other.StockNumber == this.StockNumber &&
				other.Title == this.Title &&
				other.TransmissionId == this.TransmissionId &&
				other.TrimLevel == this.TrimLevel &&
				other.UserId == this.UserId &&
				other.Vin == this.Vin &&
				other.Year == this.Year
				);
		}

		/// <summary>
		/// Serves as a hash function for this type.
		/// </summary>
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		#endregion

		#region IDataErrorInfo
		/// <summary />
		string System.ComponentModel.IDataErrorInfo.Error
		{
			get { return this.GetObjectDataErrorInfo(); }
		}

		/// <summary />
		/// <param name="columnName"></param>
		/// <returns></returns>
		string System.ComponentModel.IDataErrorInfo.this[string columnName]
		{
			get
			{
				if (string.IsNullOrEmpty(columnName))
					return string.Empty;

				var retval = GetObjectPropertyDataErrorInfo(columnName);
				if (string.IsNullOrEmpty(retval))
				{
				}
				return retval;
			}
		}
		#endregion

	}

}

